﻿// 需要拦截器的地方使用instance对象， 有自定义返回逻辑的地方沿用axios，在组件内部处理返回结果即可
import request from '/@/utils/request';

export default function () {
    /**
     * 分页查询
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const queryRecord = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Order/QueryPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 总数
     * @returns 返回接口数据
     */
    const total = () => {
        return request({
            url: "/SysApi/Exocytosis/Order/Total",
            method: "get"
        });
    };

    /**
     * 省份总数
     * @returns 返回接口数据
     */
    const provinceTotal = () => {
        return request({
            url: "/SysApi/Exocytosis/Order/ProvinceTotal",
            method: "get"
        });
    };

    /**
     * 导出Excel文件
     * @param params 要传的参数值
     * @returns 返回Excel文件
     */
    const exportExcel = (params: object) => {
            return request({
                url: "/SysApi/Exocytosis/Order/ExportExcel",
                method: "post",
                headers: { 'Content-Type': 'application/json-patch+json' },
                data: params,
                responseType: 'blob'
            });
        };

    /**
     * 修改账单退费状态
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const editIsRefund = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Order/EditIsRefund",
            method: "get",
            params
        });
    };

    /**
     * 数据回调-给渠道同步订单
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const appendChannelOrder = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Order/AppendChannelOrder",
            method: "get",
            params
        });
    };

    /**
     * 订单反馈
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const orderFeedback = (params: object) => {
        return request({
            url: "/SysApi/Exocytosis/Order/OrderFeedback",
            method: "get",
            params
        });
    };

    return {
        queryRecord,
        total,
        provinceTotal,
        exportExcel,
        editIsRefund,
        appendChannelOrder,
        orderFeedback
    };
}
